package cn.szzsi._admin;


import cn.szzsi.common.kit.CommonUtil;
import cn.szzsi.common.model.Activity;
import com.jfinal.kit.StrKit;

/**
 * 商户后台类 -商户营销活动
 * Created by yuanzhneg on 2016/11/18.
 */
public class ActivityController extends BaseAdminController<Activity> {
    private Activity activity;
    private String shopId;
    //活动列表
    public void list(){
        render("activity_list.html");
    }

    public void add(){
        render("activity_input.html");
    }
    public void edit(){
        String id=getPara("id");
        if(StrKit.notBlank(id)){
            setAttr("activity",Activity.dao.findById(id));
        }
        render("activity_input.html");
    }
    public void save(){
        shopId=getAttr("shopId");
        activity=getModel(Activity.class);
        activity.set("uid",shopId);
        saved(activity);
        redirect("list");
    }
    public void update(){
        activity=getModel(Activity.class);
        updated(activity);
        redirect("/shop/activities/list");
    }



}
